package lab02.test24;
import java.util.*;
public class Date extends java.util.Date {
    int day;
    int month;
    int year;

    public Date(){}

    public Date(int year,int month,int day){
        this.day=day;
        this.month=month;
        this.year=year;
    }

    public void funtion(Date d){
        int newDay =d.day;
        int newMonth =d.month;
        int newYear = d.year;
        Calendar c1=Calendar.getInstance();
        c1.set(newYear,newMonth,newDay);
        long n1 = c1.getTimeInMillis();

        Calendar c2 =Calendar.getInstance();
        c2.set(year,month,day);
        long  n2 =c2.getTimeInMillis();
        System.out.println("相差天数："+Math.abs(n1-n2)/24/3600/1000);
    }

    public static void main(String[] args) {
        Date d1 = new Date(2012,12,31);
        Date d2 =new Date(2015,05,17);
        d1.funtion(d2);
    }
}
